<template>
  <div class="user1-page">
    <div class="search-params f-r a-c j-b">
      <el-form inline>
        <el-form-item label="关键词：">
          <el-input v-model="searchParams.queryName" clearable />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" round @click="onSearch">筛选</el-button>
          <el-button round @click="onReset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table-box">
      <el-table
          v-loading="loading"
          stripe
          :data="tableData"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(255, 255, 255, 0.8)"
          @selection-change="onSelect"
      >
        <el-table-column type="selection" width="80px" align="center" />
        <el-table-column type="index" width="80px" label="序号" align="center" />
        <el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" align="center" />
        <el-table-column label="批文附件" fixed="right" width="120px">
          <template slot-scope="scope">
            <span @click="godownload(scope.row.file)">查看</span>

            <!-- <ClickDownload :file="scope.row.file"/> -->
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import crud from '@/mixins/crud'
import {http_project2} from "@/api"
import { downloadFile } from '@/utils/request'
export default {
  name: 'Index',
  mixins: [crud],
  props: {
    currentDetail: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      request: {
        page: http_project2.piwenPage
      },
      searchParams: {
        queryName: ''
      },
      columns: [
        { prop: 'approvalItemid', label: '办件编号' },
        { prop: 'approvalDate', label: '批复日期' },
        { prop: 'approvalNumber', label: '批复文号' },
        { prop: 'approvalTitle', label: '批复文件标题' },
      ],
      tableData: []
    }
  },
  methods: {
    getQueryParams() {
      const params = {
        pageNo: this.pageNo,
        pageSize: this.pageSize
      }
      return {
        ...params,
        ...this.searchParams,
        projectCode: this.currentDetail.projectCode
      }
    },
    godownload(url) {
      http_project2.geturl(url).then(res => {
        console.log(res)
        // downloadFile(this.fileUrl, this.fileName)
      })
    }
  }
}
</script>

<style scoped lang="scss">
</style>
